Skip to content

Split gd_color.c[ch] (sync with upstream)#17324

Open
cmb69 wants to merge 1 commit into
php:masterfrom
cmb69:cmb/gd_color
Open

Split gd_color.c[ch] (sync with upstream)#17324
cmb69 wants to merge 1 commit into
php:masterfrom
cmb69:cmb/gd_color

Conversation

@cmb69

@cmb69 cmb69 commented Jan 2, 2025

Copy link
Copy Markdown
Member

I have no idea why this has diverged in the first place. Upstream introduced gd_color.[ch] already in 2008, while we have cropping support only since 2013. Anyhow, syncing with upstream now is better than never.

The code is the same, except for libgd/libgd@d500229, what I don't understand, since there has been no int division in the first place due to usual arithmetic conversions, but at least there is not even a minor BC break. (Also note that this calculation doesn't make much sense, see libgd/libgd#334).

One caveat, though: gd_color.h is now exported (see #16070; need to work on that).

@Girgias

Girgias commented Jan 2, 2025

Copy link
Copy Markdown
Member

My guess is that floating point division is one order of magnitude slower than multiplication: http://ithare.com/infographics-operation-costs-in-cpu-clock-cycles/

@cmb69

cmb69 commented Jan 2, 2025

Copy link
Copy Markdown
Member Author

Ah, thank you @Girgias, I wasn't aware of that (and misunderstood the commit message).

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have there been changes to upstream again or not? Otherwise I think this is good to land.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants